﻿<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %>
<div id="notifypartial">
    <div id="scrlContainer">
        <div id="scrlContent">
            <%if (ViewData["notify_content"] != null)
              { %>
            <a href="#" onclick="shownewnotify()">
                <%=ViewData["notify_content"]%>
            </a>
            <%} %>
        </div>
</div>
</div>

<script type="text/javascript">
    var scrlSpeed = 1;
    scrlSpeed = (document.all) ? scrlSpeed : Math.max(1, scrlSpeed - 1);

    function initScroll(container, object) {
        if (document.getElementById(container) != null) {
            var contObj = document.getElementById(container);
            var obj = document.getElementById(object);
            contObj.style.visibility = "visible";
            contObj.scrlSpeed = scrlSpeed;
            widthContainer = contObj.offsetWidth;
            obj.style.left = parseInt(widthContainer) + "px";
            widthObject = obj.offsetWidth;
            interval = setInterval("objScroll('" + container + "','" + object + "'," + widthContainer + ")", 20);
            contObj.onmouseover = function() {
                contObj.scrlSpeed = 0;
            }
            contObj.onmouseout = function() {
                contObj.scrlSpeed = scrlSpeed;
            }
        }
    }

    function objScroll(container, object, widthContainer) {
        var contObj = document.getElementById(container);
        var obj = document.getElementById(object);
        widthObject = obj.offsetWidth;
        if (parseInt(obj.style.left) > (widthObject * (-1))) {
            obj.style.left = parseInt(obj.style.left) - contObj.scrlSpeed + "px";
        } else {
            obj.style.left = parseInt(widthContainer) + "px";
        }
    }

    initScroll("scrlContainer", "scrlContent");

    function shownewnotify() {
        $.ajax({
            type: "POST",
            url: "/Notify/NotifyShowNew",
            success: function(data) {
                addtab("notifyshownew", "最新公告");
                $("#workarea-notifyshownew").html(data);
            }
        })
    }
</script>

<style type="text/css">
    #scrlContainer
    {
        visibility: hidden;
        position: relative;
        overflow: hidden;
        height: 20px;
        line-height: 20px;
        margin: 1em;
    }
    #scrlContent
    {
        position: absolute;
        left: 0;
        top: 0;
        white-space: nowrap;
    }
</style>
